import request from '@/utils/request'

// 获取员工列表
export function sysUser (data) {
  return request({
    url: '/sys/user',
    // data // 请求体参数
    params: data // 查询参数
  })
}

// 新增员工
export function sysUserPost (data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 删除员工
export function sysUserDel (id) {
  return request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}

// 批量新增 员工
export function sysUserBatch (data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

// 员工个人信息
export function employeesPersonalInfo (id) {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}
// 员工个人信息更新
export function employeesPersonalInfoPut (data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

// 员工岗位详情
export function employeesJobs (id) {
  return request({
    url: `/employees/${id}/jobs`
  })
}
// 员工岗位详情更新
export function employeesJobsPut (data) {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}

export function sysUserAssignRoles (id, permIds) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data: {
      id,
      permIds
    }
  })
}
